import 'package:flutter/material.dart';

class ItemCounter extends StatefulWidget {
  final String name;

  const ItemCounter(this.name);

  @override
  _ItemCounterState createState() => _ItemCounterState();
}

class _ItemCounterState extends State<ItemCounter> {
  int counter = 0;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        onTap: () {
          setState(() {
            counter++;
          });
        },
        child: Text('${widget.name}: $counter'));
  }
}
